import { serve } from '@hono/node-server'
import { Hono } from 'hono'
import { v4 as uuidv4 } from 'uuid'
const app = new Hono()

// 测试接口
app.get('/api/test', (c) => {
  const uuid = uuidv4()
  return c.json({
    status: 200,
    data: uuid + ` ${process.env.TEST_KEY} ` + 'Hello Hono!',
    message: 'success'
  })
})


const port = parseInt(process.env.API_PORT || '3000')
console.log(`API Server is running on http://localhost:${port}`)

serve({
  fetch: app.fetch,
  port
})
